home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: nntp.coast.net!torn!nott!cunews!news
- From: Alex Fitzpatrick <ug940002@omega.scs.carleton.ca>
- Subject: Re: Question on storing a char as an int and retrieving it
- X-Nntp-Posting-Host: alpha06.scs.carleton.ca
- Content-Type: text/plain; charset=us-ascii
- Message-ID: <311518FC.3D61@omega.scs.carleton.ca>
- Sender: news@cunews.carleton.ca (News Administrator)
- Content-Transfer-Encoding: 7bit
- Organization: Carleton University
- References: <miller.2.0025DF55@crosslink.net>
- Mime-Version: 1.0
- Date: Sun, 4 Feb 1996 20:37:16 GMT
- X-Mailer: Mozilla 2.0b6b (Win16; I)
-
- Randall Miller wrote:
- >
- > This might seem like as easy question, but I do need help
- >
- > if I read in a char and store it in a stack of integers, I know how to
- > output it as a char by using cout.put(), but if I want to pop it off the stack
- > and act on it as a char how do I convert it back to a char?
-
- Unless I really misunderstood, you can simply use a cast on it.
-
- So if your stack has a pop operation that returns an int:
-
- char aChar = (char) theStack.pop();
-
- Or did I miss the point?
-
- Alex
-